package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringStartsWithAnyIterable {
	public static boolean startsWithAny(Iterable<String> stringList,
	                                    String str) {
		return getStartingIndex(stringList, str) != -1;
	}

	public static int getStartingIndex(Iterable<String> stringList,
	                                   String examinedString) {
		int i = 0;
		for (String string : stringList) {
			if (examinedString.startsWith(string)) {
				return i;
			}
			i++;
		}
		return -1;
	}
}
